<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      div {
        border: 3px solid;
        padding: 10px;
        background-color: white;
      }
      div > b:hover {
        cursor: pointer;
        background-color: yellow;
      }
    </style>
  </head>
  <body>
    <div id="box1">
      <b>box1</b>
      <div id="box2">
        <b>box2</b>
        <div id="box3"><b>box3</b></div>
      </div>
    </div>
    <script>
      box1.onclick = function (e) {
        console.log(1, e.target, this);
      };
      box2.onclick = function (e) {
        console.log(2, e.target, this);
      };
      box3.onclick = function (e) {
        console.log(3, e.target, this);
      };
    </script>
  </body>
</html>
